#include "sila.h"
#include "Node.h"
#include "dll.h"
using namespace sila;

Sila::Sila()
{

}

Sila::~Sila()
{

}

void Sila::Process(const std::string & buffer)
{
	if (parser_.Parse(buffer)){
		node::Node * r = parser_.Root();
		if (r != NULL){
			output_ = r->Execute();
			return;
		}
	}	
	output_ = "dupa";
}

const std::string& Sila::Output() const
{
	return output_;
}

Sila __sila;

extern "C" {


LIBSILA_API const char* silaEntry(const char* data)
{
	__sila.Process(data);
	return __sila.Output().c_str();
}

}
